using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._AnalysisTools._Statistics
{
    /// <summary>
    /// <para>Summary Statistics</para>
    /// <para>Calculates summary statistics for fields in a table.</para>
    /// <para>计算表中字段的汇总统计数据。</para>
    /// </summary>    
    [DisplayName("Summary Statistics")]
    public class Statistics : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public Statistics()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_table">
        /// <para>Input Table</para>
        /// <para>The input table containing the fields that will be used to calculate statistics.</para>
        /// <para>包含将用于计算统计数据的字段的输入表。</para>
        /// </param>
        /// <param name="_out_table">
        /// <para>Output Table</para>
        /// <para>The output table that will store the calculated statistics.</para>
        /// <para>将存储计算统计信息的输出表。</para>
        /// </param>
        /// <param name="_statistics_fields">
        /// <para>Statistics Field(s)</para>
        /// <para><xdoc>
        ///   <para>Specifies the numeric field or fields containing the attribute values that will be used to calculate the specified statistic. Multiple statistic and field combinations can be specified. Null values are excluded from all statistical calculations.</para>
        ///   <para>Text attribute fields can be summarized using first and last statistics. Numeric attribute fields can be summarized using any statistic.</para>
        ///   <para>Available statistics types are as follows:</para>
        ///   <bulletList>
        ///     <bullet_item>Sum—The values for the specified field will be added together.</bullet_item><para/>
        ///     <bullet_item>Mean—The average for the specified field will be calculated.</bullet_item><para/>
        ///     <bullet_item>Minimum—The smallest value for all records of the specified field will be found.</bullet_item><para/>
        ///     <bullet_item>Maximum—The largest value for all records of the specified field will be found.</bullet_item><para/>
        ///     <bullet_item>Range—The range of values (maximum minus minimum) for the specified field will be calculated.</bullet_item><para/>
        ///     <bullet_item>Standard deviation—The standard deviation of values in the specified field will be calculated.</bullet_item><para/>
        ///     <bullet_item>Count—The number of values included in the statistical calculations will be found. Each value will be counted except null values. To determine the number of null values in a field, create a count on the field in question, create a count on a different field that does not contain null values (for example, the OID if present), and subtract the two values.</bullet_item><para/>
        ///     <bullet_item>First—The specified field value of the first record in the input will be used.</bullet_item><para/>
        ///     <bullet_item>Last—The specified field value of the last record in the input will be used.</bullet_item><para/>
        ///     <bullet_item>Median—The median for all records of the specified field will be calculated.</bullet_item><para/>
        ///     <bullet_item>Variance—The variance for all records of the specified field will be calculated.</bullet_item><para/>
        ///     <bullet_item>Unique—The number of unique values of the specified field will be counted.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定包含将用于计算指定统计数据的属性值的一个或多个数值字段。可以指定多个统计量和字段组合。空值从所有统计计算中排除。</para>
        ///   <para>可以使用第一个和最后一个统计信息对文本属性字段进行汇总。可以使用任何统计数据对数值属性字段进行汇总。</para>
        ///   <para>可用的统计信息类型如下：</para>
        ///   <bulletList>
        ///     <bullet_item>Sum—指定字段的值将相加。</bullet_item><para/>
        ///     <bullet_item>均值—将计算指定字段的平均值。</bullet_item><para/>
        ///     <bullet_item>最小值—将找到指定字段的所有记录的最小值。</bullet_item><para/>
        ///     <bullet_item>最大值—将找到指定字段的所有记录的最大值。</bullet_item><para/>
        ///     <bullet_item>范围—将计算指定字段的值范围（最大值减去最小值）。</bullet_item><para/>
        ///     <bullet_item>标准差—将计算指定字段中值的标准差。</bullet_item><para/>
        ///     <bullet_item>计数—将找到统计计算中包含的值数。除 null 值外，将计算每个值。若要确定字段中 null 值的数目，请在相关字段上创建计数，在不包含 null 值的其他字段上创建计数（例如，如果存在 OID），然后减去这两个值。</bullet_item><para/>
        ///     <bullet_item>First - 将使用输入中第一条记录的指定字段值。</bullet_item><para/>
        ///     <bullet_item>最后 - 将使用输入中最后一条记录的指定字段值。</bullet_item><para/>
        ///     <bullet_item>中位数—将计算指定字段的所有记录的中位数。</bullet_item><para/>
        ///     <bullet_item>方差—将计算指定字段的所有记录的方差。</bullet_item><para/>
        ///     <bullet_item>唯一 - 将计算指定字段的唯一值数。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// </param>
        public Statistics(object _in_table, object _out_table, object _statistics_fields)
        {
            this._in_table = _in_table;
            this._out_table = _out_table;
            this._statistics_fields = _statistics_fields;
        }
        public override string ToolboxName => "Analysis Tools";

        public override string ToolName => "Summary Statistics";

        public override string CallName => "analysis.Statistics";

        public override List<string> AcceptEnvironments => ["configKeyword", "scratchWorkspace", "workspace"];

        public override object[] ParameterInfo => [_in_table, _out_table, _statistics_fields, _case_field];

        /// <summary>
        /// <para>Input Table</para>
        /// <para>The input table containing the fields that will be used to calculate statistics.</para>
        /// <para>包含将用于计算统计数据的字段的输入表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_table { get; set; }


        /// <summary>
        /// <para>Output Table</para>
        /// <para>The output table that will store the calculated statistics.</para>
        /// <para>将存储计算统计信息的输出表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_table { get; set; }


        /// <summary>
        /// <para>Statistics Field(s)</para>
        /// <para><xdoc>
        ///   <para>Specifies the numeric field or fields containing the attribute values that will be used to calculate the specified statistic. Multiple statistic and field combinations can be specified. Null values are excluded from all statistical calculations.</para>
        ///   <para>Text attribute fields can be summarized using first and last statistics. Numeric attribute fields can be summarized using any statistic.</para>
        ///   <para>Available statistics types are as follows:</para>
        ///   <bulletList>
        ///     <bullet_item>Sum—The values for the specified field will be added together.</bullet_item><para/>
        ///     <bullet_item>Mean—The average for the specified field will be calculated.</bullet_item><para/>
        ///     <bullet_item>Minimum—The smallest value for all records of the specified field will be found.</bullet_item><para/>
        ///     <bullet_item>Maximum—The largest value for all records of the specified field will be found.</bullet_item><para/>
        ///     <bullet_item>Range—The range of values (maximum minus minimum) for the specified field will be calculated.</bullet_item><para/>
        ///     <bullet_item>Standard deviation—The standard deviation of values in the specified field will be calculated.</bullet_item><para/>
        ///     <bullet_item>Count—The number of values included in the statistical calculations will be found. Each value will be counted except null values. To determine the number of null values in a field, create a count on the field in question, create a count on a different field that does not contain null values (for example, the OID if present), and subtract the two values.</bullet_item><para/>
        ///     <bullet_item>First—The specified field value of the first record in the input will be used.</bullet_item><para/>
        ///     <bullet_item>Last—The specified field value of the last record in the input will be used.</bullet_item><para/>
        ///     <bullet_item>Median—The median for all records of the specified field will be calculated.</bullet_item><para/>
        ///     <bullet_item>Variance—The variance for all records of the specified field will be calculated.</bullet_item><para/>
        ///     <bullet_item>Unique—The number of unique values of the specified field will be counted.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定包含将用于计算指定统计数据的属性值的一个或多个数值字段。可以指定多个统计量和字段组合。空值从所有统计计算中排除。</para>
        ///   <para>可以使用第一个和最后一个统计信息对文本属性字段进行汇总。可以使用任何统计数据对数值属性字段进行汇总。</para>
        ///   <para>可用的统计信息类型如下：</para>
        ///   <bulletList>
        ///     <bullet_item>Sum—指定字段的值将相加。</bullet_item><para/>
        ///     <bullet_item>均值—将计算指定字段的平均值。</bullet_item><para/>
        ///     <bullet_item>最小值—将找到指定字段的所有记录的最小值。</bullet_item><para/>
        ///     <bullet_item>最大值—将找到指定字段的所有记录的最大值。</bullet_item><para/>
        ///     <bullet_item>范围—将计算指定字段的值范围（最大值减去最小值）。</bullet_item><para/>
        ///     <bullet_item>标准差—将计算指定字段中值的标准差。</bullet_item><para/>
        ///     <bullet_item>计数—将找到统计计算中包含的值数。除 null 值外，将计算每个值。若要确定字段中 null 值的数目，请在相关字段上创建计数，在不包含 null 值的其他字段上创建计数（例如，如果存在 OID），然后减去这两个值。</bullet_item><para/>
        ///     <bullet_item>First - 将使用输入中第一条记录的指定字段值。</bullet_item><para/>
        ///     <bullet_item>最后 - 将使用输入中最后一条记录的指定字段值。</bullet_item><para/>
        ///     <bullet_item>中位数—将计算指定字段的所有记录的中位数。</bullet_item><para/>
        ///     <bullet_item>方差—将计算指定字段的所有记录的方差。</bullet_item><para/>
        ///     <bullet_item>唯一 - 将计算指定字段的唯一值数。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Statistics Field(s)")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _statistics_fields { get; set; }


        /// <summary>
        /// <para>Case field</para>
        /// <para>The field or fields in the input used to calculate statistics separately for each unique attribute value (or combination of attribute values when multiple fields are specified).</para>
        /// <para>输入中的一个或多个字段，用于分别计算每个唯一属性值的统计数据（或指定多个字段时属性值的组合）。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Case field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _case_field { get; set; } = null;


        public Statistics SetEnv(object configKeyword = null, object scratchWorkspace = null, object workspace = null)
        {
            base.SetEnv(configKeyword: configKeyword, scratchWorkspace: scratchWorkspace, workspace: workspace);
            return this;
        }

    }

}